import { ItemPanelController } from "./ItemPanelController";


export class labelpanelcontroller extends ItemPanelController {

    msg = 0;

    labelmsg_label: cc.Node;

    onStart() {

        //使用多层级面板
        let panel_Content = this._ScrollViewMgr.GetLabelContent();
        let labelnode = panel_Content[0].getChildByName(this.node.name)
        this.labelmsg_label = cc.find('label', labelnode);

        //不使用多层级面板
        //this.labelmsg_label = cc.find('label', this.node);

        this.node.on('touchend', () => {
            console.log(this.msg);
            console.log(this.node.getSiblingIndex())
        }, this)
    }

    ResetPanel(res) {
        if (res == undefined) { return }
        this.msg = res;
        this.labelmsg_label.getComponent(cc.Label).string = this.msg.toString();
    }
}

export class labelpanelcontroller2 extends ItemPanelController {

    msg = 0;

    labelmsg_label: cc.Node;

    onStart() {

        //使用多层级面板
        //let panel_Content = this._ScrollViewMgr.GetLabelContent();
        //let labelnode = panel_Content[0].getChildByName(this.node.name)
        //this.labelmsg_label = cc.find('label', labelnode);

        //不使用多层级面板
        this.labelmsg_label = cc.find('label', this.node);

        this.node.on('touchend', () => {
            console.log(this.msg);
            console.log(this.node.getSiblingIndex())
        }, this)
    }

    ResetPanel(res) {
        if (res == undefined) { return }
        this.msg = res;
        this.labelmsg_label.getComponent(cc.Label).string = this.msg.toString();
    }
}